'''
错误示范，min函数不能用
'''
# -*- coding:utf-8 -*-
class Solution:
    def __init__(self):
        self.stack = []
        self.minList = []
    def push(self, node):
        # write code here
        if not self.minList:
            self.minList.append(node)
        else:
            self.minList.append(min(self.minList[-1], node))
        self.stack.append(node)
    def pop(self):
        # write code here
        if not self.stack:
            return None
        out = self.stack.pop()
        if out==self.minList[-1]:
            self.minList.pop()
        return out
    def top(self):
        # write code here
        if not self.stack:
            return None
        return self.stack[-1]
    def min(self):
        # write code here
        if not self.minList:
            return None
        return self.minList[-1]

'''
正确姿势用<=就好了
'''
# -*- coding:utf-8 -*-
class Solution:
    def __init__(self):
        self.stack = []
        self.minList = []
    def push(self, node):
        # write code here
        if not self.minList or node<= self.minList[-1]:
            self.minList.append(node)
        self.stack.append(node)
    def pop(self):
        # write code here
        if not self.stack:
            return None
        out = self.stack.pop()
        if out==self.minList[-1]:
            self.minList.pop()
        return out
    def top(self):
        # write code here
        if not self.stack:
            return None
        return self.stack[-1]
    def min(self):
        # write code here
        if not self.minList:
            return None
        return self.minList[-1]